package com.itboye.qihang.logincontroller;


import android.app.Activity;
import android.util.Log;



/**
 * 登录相关控制类--状态模式</br></br>
 * <p>
 * 登录成功后调用setLoginState(new LoginedState());</br></br>
 * 退出登录后调用setLoginState(new UnLoginState());</br></br>
 * 进入主Activity前一定要设置一次，要么登录要么未登录</br></br>
 *
 * @author Mr.w
 */
public class LoginController {

    private static ILoginState loginState = new UnLoginState();
//    private static PushAgent mPushAgent;


    public static void setLoginState(ILoginState loginState) {

        LoginController.loginState = loginState;
        if (loginState instanceof UnLoginState) {
            Log.d("LoginLoginLoginLogin", "未登录");
        } else if (loginState instanceof LoginedState) {
            Log.d("LoginLoginLoginLogin", "已登录。。。");

//            mPushAgent = MyApplication.getInstance().getmPushAgent();
//            // mPushAgent.setPushIntentServiceClass(MyPushIntentService.class);
//            mPushAgent.onAppStart();
//
//            String uid = (String) SPUtils.get(MyApplication.instatnce, null,
//                    Const.UID, "");
//
//            Log.d("====uid===",uid+"");
//            mPushAgent.addExclusiveAlias(uid, Const.UMENG_ALIAS, new UTrack.ICallBack() {
//                @Override
//                public void onMessage(boolean arg0, String arg1) {
//                    // TODO Auto-generated method stub
//                    System.out.println(arg0 + "arg222" + arg1);
//                }
//            });


        }
    }

    /**
     * 个人信息
     */
    public static void PersonnalInfomaton(Activity activity, Object data) {
        loginState.PersonnalInfomaton(activity, data);
    }

}
